//*********************************************************
//
// Output Registers used:
//   oPos - The vertex output position.
//   oT0  - Light direction in tangentspace
//   oT1  - original UV for normal map
//
//*********************************************************

// oPos = MVP * position
m4x4 r0, inPos, c[MODEL_VIEW_PROJECTION]
mov oPos, r0

// oT1 = texcoord
mov oT1, inUV

// r4 = TangentMatrix[-1] * (LightPos - position)
sub  r1, c[VL_MODEL_SPACE_LIGHT_POS], inPos		// r0 = SLight Position - vertex_pos
dp3  r4.x, v3, -r1
dp3  r4.y, v4, r1
dp3  r4.z, inNormal, r1

// oT0 = r4
mov oT0.xyz, r4
